<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0028)http://jdbi.org/archive.html -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>


<title>abacus-common</title>

<script type="text/javascript" src="./css/ga.js"></script>
<script type="text/javascript">
	if (top.location != self.location)
		top.location.replace(self.location);
</script>

<link href="./css/css" rel="stylesheet" type="text/css"></link>
<link href="./css/css(1)" rel="stylesheet" type="text/css"></link>
<link rel="stylesheet" href="./css/syntax.css" type="text/css"></link>
<link rel="stylesheet" href="./css/screen.css" type="text/css"></link>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-65247258-1', 'auto');
  ga('send', 'pageview');
</script>

</head>
<body>
	<div id="site">
		<h1>
			<a href="./index.html">abacus-common</a> <span id="navigation"> <a href="./docs.html">Docs</a> | <a href="./download.html">Download</a>
				| <a href="./api-docs/index.html">Javadoc</a> | <a href="./faq.html">FAQ</a> | <a href="./community.html">Community</a>
			</span>
		</h1>
	</div>

	<div id="content">

		<div id="page">
			<h1>Code Generation</h1>
			<p>
				It's easy to generate tens, even hundreds of lines of pretty-formatted entity class with couple of lines of codes. Here is a simple sample: (<a href="./Account.java">Account.java</a>)
			</p>
<!-- HTML generated using hilite.me --><div style="background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #408080; font-style: italic">// 1, Productivity: generate tens, even hundreds of lines of code by couple of lines of codes in one minute.</span>
<span style="color: #408080; font-style: italic">// 2. Maintainability: It&#39;s easy and simple to add/remove fields or change types of fields. And all the codes follow the same format.</span>
<span style="color: #408080; font-style: italic">// 3. Bug free. No test is required for the auto-generated codes and no test coverage is counted. </span>
File srcDir <span style="color: #666666">=</span> <span style="color: #008000; font-weight: bold">new</span> File<span style="color: #666666">(</span><span style="color: #BA2121">&quot;./src&quot;</span><span style="color: #666666">);</span>
String packageName <span style="color: #666666">=</span> <span style="color: #BA2121">&quot;com.x.y&quot;</span><span style="color: #666666">;</span>

Map<span style="color: #666666">&lt;</span>String<span style="color: #666666">,</span> Object<span style="color: #666666">&gt;</span> fields <span style="color: #666666">=</span> N<span style="color: #666666">.</span><span style="color: #7D9029">asLinkedHashMap</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;firstName&quot;</span><span style="color: #666666">,</span> String<span style="color: #666666">.</span><span style="color: #7D9029">class</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;lastName&quot;</span><span style="color: #666666">,</span> String<span style="color: #666666">.</span><span style="color: #7D9029">class</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;birthdate&quot;</span><span style="color: #666666">,</span> Date<span style="color: #666666">.</span><span style="color: #7D9029">class</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;email&quot;</span><span style="color: #666666">,</span> String<span style="color: #666666">.</span><span style="color: #7D9029">class</span><span style="color: #666666">,</span>
        <span style="color: #BA2121">&quot;address&quot;</span><span style="color: #666666">,</span> String<span style="color: #666666">.</span><span style="color: #7D9029">class</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;attrs&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;Map&lt;String, List&lt;java.sql.Date&gt;&gt;&quot;</span><span style="color: #666666">);</span>
CodeGenerator<span style="color: #666666">.</span><span style="color: #7D9029">generateEntity</span><span style="color: #666666">(</span>srcDir<span style="color: #666666">,</span> packageName<span style="color: #666666">,</span> <span style="color: #BA2121">&quot;Account&quot;</span><span style="color: #666666">,</span> fields<span style="color: #666666">);</span>
</pre></div>



		<p></p>
                 
		<p>Entities can also be easily generated from database tables by the steps in <a href="./code-generation-2.html">Code Generation 2</a>. It will accelerate the development and make your codes much cleaner by the above auto-generated classes. It's a lot of efforts we have spent to write this utility class to generate the pretty-formatted codes. We hope you will like it and enjoy programming with it. Refer to project <a href="./Helloabacus-common.zip">Helloabacus-common.zip</a> for the complete codes.</p>

		</div>

	</div>
</body>

</html>